package core;

import java.util.ArrayList;
import java.util.List;

public enum MXitCommandType {
		UNKNOWN						(-1),
		MSG_REQ_RESP				(10),
		POLL_MSG					(9),
		LOGIN						(1),
		UPDATE_CONTACTS				(3),
		UPDATE_CONTACTS_STATUS		(7),
		UPDATE_CONTACTS_INFO		(5)
		;
		
		//public final static MXitCommandType[] command;
		public final static List<MXitCommandType> command = new ArrayList<MXitCommandType>();
		
		static{
			for(MXitCommandType cmd:MXitCommandType.values()){
				if (cmd != UNKNOWN) {
					command.add(cmd.getId(), cmd);
				}
			}
		}
		
		private final int id;
		
		MXitCommandType(int id){
			this.id=id;
		}
		
		static MXitCommandType cmd(int id){
			return (id != -1 ? command.get(id):UNKNOWN);
		}
		
		public int getId(){ return id; };
}
